var t = require("../../../../@babel/runtime/helpers/defineProperty"), a = getApp();

Component({
    properties: {},
    data: {
        show: !1,
        popUpType: "",
        popUpTitle: "",
        dataList: [],
        alipayForm: {
            alipay: "",
            alipayname: ""
        },
        weChatForm: {
            wechat: ""
        }
    },
    methods: {
        checkShow: function() {
            this.setData({
                show: !0
            });
        },
        stateChanges: function(t) {
            "alipay" == t ? this.setData({
                popUpType: t,
                popUpTitle: "支付宝账号"
            }) : "weChat" == t && this.setData({
                popUpType: t,
                popUpTitle: "微信号"
            });
        },
        onClose: function() {
            this.setData({
                show: !1
            });
        },
        confirm: function() {
            var t = this, e = this, i = "", o = {};
            if ("alipay" == this.data.popUpType) {
                if (a._isTextEmpty(this.data.alipayForm.alipay)) return void wx.showToast({
                    icon: "none",
                    title: "请输入账号",
                    duration: 1500
                });
                if (a._isTextEmpty(this.data.alipayForm.alipayname)) return void wx.showToast({
                    icon: "none",
                    title: "请输入姓名",
                    duration: 1500
                });
                i = "member.member-info.change-alipay-info", o = this.data.alipayForm;
            } else if ("weChat" == this.data.popUpType) {
                if (a._isTextEmpty(this.data.weChatForm.wechat)) return void wx.showToast({
                    icon: "none",
                    title: "请输入账号",
                    duration: 1500
                });
                i = "member.member-info.change-wechat", o = this.data.weChatForm;
            }
            var s = a.getNetAddresss(i);
            a._getNetWork({
                url: s,
                data: o,
                success: function(a) {
                    var i = a.data;
                    1 == i.result ? (wx.showToast({
                        icon: "none",
                        title: i.msg,
                        duration: 1500
                    }), e.childGetData(), t.setData({
                        show: !1
                    })) : wx.showToast({
                        icon: "none",
                        title: i.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        childGetData: function() {
            this.triggerEvent("childGetData");
        },
        onChange: function(t) {
            "alipay" == t.currentTarget.dataset.typevalue ? this.setData({
                "alipayForm.alipay": t.detail
            }) : "wechat" == t.currentTarget.dataset.typevalue ? this.setData({
                "weChatForm.wechat": t.detail
            }) : "alipayname" == t.currentTarget.dataset.typevalue && this.setData({
                "alipayForm.alipayname": t.detail
            });
        },
        assignment: function(a, e) {
            this.setData(t({}, a, e));
        }
    }
});